package model

import (
	"time"

	"go.mongodb.org/mongo-driver/bson/primitive"
)

const (
	StatusStarting     = "starting"
	StatusProcessing   = "processing"
	StatusUploaded     = "uploaded"
	StatusFailed       = "failed"
	StatusDeleteFailed = "delete failed"
	StatusDeleted      = "deleted"
)

const (
	ParsePending    = "pending"
	ParseProcessing = "processing"
	ParseSuccess    = "success"
	ParseFailed     = "failed"
)

func IsValidParseStatus(status string) bool {
	switch status {
	case ParsePending, ParseProcessing, ParseSuccess, ParseFailed:
		return true
	default:
		return false
	}
}

type Paper struct {
	ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
	// TODO: Fill your own fields
	UpdateAt time.Time `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	CreateAt time.Time `bson:"createAt,omitempty" json:"createAt,omitempty"`

	FileName    string `bson:"file_name" json:"file_name"`
	FileSize    int64  `bson:"file_size" json:"file_size"`
	ContentType string `bson:"content_type" json:"content_type"`
	UserId      int64  `bson:"user_id" json:"user_id"`

	// MinIO存储
	Status      string `bson:"status" json:"status"` // uploaded/processing/failed
	MinIOBucket string `bson:"minio_bucket" json:"minio_bucket"`
	MinIOObject string `bson:"minio_object" json:"minio_object"` // 合并路径与文件名
	ETag        string `bson:"etag" json:"etag"`

	// 向量数据库存储
	ParseStatus string `bson:"vector_status" json:"vector_status"` // pending/processed/failed
}
